package com.wellink.baseadapterdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_layout);

        ListView listView = findViewById(R.id.listview);

        MyBaseAdapater adapater = new MyBaseAdapater(this,getData(),R.layout.item_layout);
        listView.setAdapter(adapater);
    }

    protected List<Data> getData(){
        List<Data> datas = new ArrayList<>();
        datas.add(new Data(R.drawable.icon1, "小宗", "电台DJ"));
        datas.add(new Data(R.drawable.icon2, "貂蝉", "四大美女"));
        datas.add(new Data(R.drawable.icon3, "奶茶", "清纯妹妹"));
        datas.add(new Data(R.drawable.icon4, "大黄", "是小狗"));
        datas.add(new Data(R.drawable.icon5, "hello", "every thing"));
        datas.add(new Data(R.drawable.icon6, "world", "hello world"));
        return  datas;
    }
}
